package product_category;

import com.github.pagehelper.PageHelper;
import com.qkss.mapper.EbProductCategoryMapper;
import com.qkss.model.EbProductCategory;
import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.ui.Model;

import java.text.Normalizer;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:xml/spring-dao.xml")

public class product_category {
    @Autowired
    private EbProductCategoryMapper ebProductCategoryMapper;

    @Test

    public void when() {

        EbProductCategory productCategory = new EbProductCategory();
        productCategory.setEpcName("玩具");
        productCategory.setEpcParentId(545);
        int result = ebProductCategoryMapper.insertSelective(productCategory);

    }

    @Test
    public void whenupdate() {
        EbProductCategory productCategory = new EbProductCategory();
        productCategory.setEpcId(630);
        productCategory.setEpcParentId(565);
        productCategory.setEpcName("儿童玩具");
        int re = ebProductCategoryMapper.updateByPrimaryKeySelective(productCategory);
    }

    @Test
    public void whenpage() {
        PageHelper.startPage(1, 5);
        List<EbProductCategory> ebProductCategories = ebProductCategoryMapper.selectByExample(null);
        for (EbProductCategory ebProductCategory : ebProductCategories) {
            System.out.println(ebProductCategories);
        }
    }
}